import request from '@/utils/request'


const api_name = '/admin/acl/permission'

export default {


    getPermissionList() {
        return request({
            url: `${api_name}`,
            method: 'get'
        })
    },


    removePermission(id) {
        return request({
            url: `${api_name}/remove/${id}`,
            method: "delete"
        })
    },


    addPermission(permission) {
        return request({
            url: `${api_name}/save`,
            method: "post",
            data: permission
        })
    },


    updatePermission(permission) {
        return request({
            url: `${api_name}/update`,
            method: "put",
            data: permission
        })
    },


    toAssign(roleId) {
        return request({
            url: `${api_name}/toAssign/${roleId}`,
            method: 'get'
        })
    },


    doAssign(roleId, permissionId) {
        return request({
            url: `${api_name}/doAssign`,
            method: "post",
            params: { roleId, permissionId }
        })
    }
}